home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / JAVA Utilities / JProxy 1.1.0 / customers / navigation-bar.jsp < prev    next >
Encoding:
Text File  |  2003-04-29  |  4.7 KB  |  147 lines

  1. <%@ page language="java" import="
  2.     java.util.*,
  3.     com.jproxy.site.*"
  4. %>
  5.  
  6. <jsp:useBean id="ses" scope="session" class="com.jproxy.site.JSPSession"/>
  7.  
  8. <%
  9. String sPageId = null;
  10. String sMenuType = "";
  11.  
  12. sPageId = ses.getParameter("pageId");
  13. if(ses.getLogin()==null)
  14.     sMenuType = MT_LOGIN;
  15. if(ses.getLogin()!=null)
  16. if(ses.getLogin().getHasClients())
  17.     sMenuType = MT_OEM;
  18. if(ses.getLogin()!=null)
  19. if(!ses.getLogin().getHasClients())
  20.     sMenuType = MT_CUSTOMER;
  21.  
  22. //sMenuType = ses.getParameter("menuType");
  23. %>
  24. <!-- NAVIGATION BAR -->
  25.  
  26. <table width="100" cellpadding=0 cellspacing=0 border=0 height=100%>
  27.   <tr>
  28.     <td valign=top>
  29.       <table border=0 cellspacing=2 cellpadding=1>
  30. <!-- Company Tab Begins -->
  31.         <tr>
  32.           <td>
  33.             <img src="<%=JSPRes.path%>/main/resources/tb-eportal.gif" alt="Customer Relation Management Console"/>
  34.           </td>
  35.         </tr>
  36.     <%
  37.  
  38.     MenuItem[] navigationBar = getNavigationBar(sMenuType);
  39.     if(navigationBar!=null)
  40.     for(int i=0; i<navigationBar.length; i++)
  41.     {
  42.         MenuItem menu = (MenuItem)navigationBar[i];
  43.     %>
  44.         <tr>
  45.           <td>
  46.         <%
  47.         if(!menu.id.equalsIgnoreCase(sPageId))
  48.         {
  49.         %>
  50.             <a class='menu' href="<%=menu.href%>" alt="<%=menu.alt%>"><%=menu.name%></a>
  51.         <%
  52.         }
  53.         else
  54.         {
  55.         %>
  56.             <span class='h8VerdanaBold'><%=menu.name%></a>
  57.         <%
  58.         }
  59.         %>
  60.           </td>
  61.         </tr>
  62.     <%
  63.     }
  64.     %>
  65.       </table>
  66.     </td>
  67.   </tr>
  68. </table>
  69.  
  70. <%!
  71. static final private String MT_LOGIN                  = "login";
  72. static final private String MT_OEM                    = "oem";
  73. static final private String MT_CUSTOMER               = "customer";
  74.  
  75. static final private String PAGE_HOME                 = "home";
  76. static final private String PAGE_LOGIN                = "login";
  77. static final private String PAGE_TERMS                = "terms";
  78. static final private String PAGE_MY_PROFILE           = "my_profile";
  79. static final private String PAGE_CUSTOMER_LIST        = "customer_list";
  80. static final private String PAGE_PRODUCT_LIST         = "product_list";
  81. static final private String PAGE_NEW_CUSTOMER         = "new_customer";
  82. static final private String PAGE_EDIT_CUSTOMER        = "edit_customer";
  83. static final private String PAGE_LOGOUT               = "logout";
  84. static final private String PAGE_PURCHASE_DETAILS     = "purchase_details";
  85. static final private String PAGE_MESSAGEBOX           = "messagebox";
  86.  
  87. private MenuItem[] m_arrLoginMenu = {
  88. //    new MenuItem(PAGE_HOME, JSPRes.path+"/main/index.jsp", "JProxy Home", "Home"),
  89.     new MenuItem(PAGE_LOGIN, JSPRes.path+"/main/customers/login.jsp", "ePortal Login", "Login"),
  90.     new MenuItem(PAGE_TERMS, JSPRes.path+"/main/customers/terms.jsp", "Terms and Conditions using ePortal", "Terms")
  91.     };
  92.  
  93. private MenuItem[] m_arrOemMenu = {
  94.     new MenuItem(PAGE_MY_PROFILE, JSPRes.path+"/main/customers/acedit.jsp?key=edit&forward=customer-list.jsp",
  95.         "Lets you change your personal information", "My Profile"),
  96.     new MenuItem(PAGE_CUSTOMER_LIST, JSPRes.path+"/main/customers/customer-list.jsp",
  97.         "Displays a list of your customers", "My Customers"),
  98.     new MenuItem(PAGE_NEW_CUSTOMER, JSPRes.path+"/main/customers/customer-edit.jsp?key=new&forward=customer-list.jsp",
  99.         "Creates a new customer", "New Customer"),
  100.     new MenuItem(PAGE_LOGOUT, JSPRes.path+"/main/customers/login.jsp?logout=true",
  101.         "Logs you out from ePortal and allows you to log in as a different user", "Logout"),
  102.     new MenuItem(PAGE_TERMS, JSPRes.path+"/main/customers/terms.jsp",
  103.         "Terms and Conditions using ePortal", "Terms")
  104.     };
  105.  
  106. private MenuItem[] m_arrCustomerMenu = {
  107.     new MenuItem(PAGE_MY_PROFILE, JSPRes.path+"/main/customers/acedit.jsp?key=edit&forward=product-list.jsp",
  108.         "Lets you change your personal information", "My Profile"),
  109.     new MenuItem(PAGE_PRODUCT_LIST, JSPRes.path+"/main/customers/product-list.jsp",
  110.         "Lets you review available products", "Products"),
  111.     new MenuItem(PAGE_LOGOUT, JSPRes.path+"/main/customers/login.jsp?logout=true",
  112.         "Logs you out from ePortal and allows you to log in as a different user", "Logout"),
  113.     new MenuItem(PAGE_TERMS, JSPRes.path+"/main/customers/terms.jsp",
  114.         "Terms and Conditions using ePortal", "Terms")
  115.     };
  116.  
  117. MenuItem[] getNavigationBar(String menuType)
  118. {
  119.     MenuItem[] res = null;
  120.     if(menuType==null)
  121.         return res;
  122.     if(menuType.equalsIgnoreCase(MT_LOGIN))
  123.         res = m_arrLoginMenu;
  124.     if(menuType.equalsIgnoreCase(MT_OEM))
  125.         res = m_arrOemMenu;
  126.     if(menuType.equalsIgnoreCase(MT_CUSTOMER))
  127.         res = m_arrCustomerMenu;
  128.     return res;
  129. }
  130.  
  131. class MenuItem
  132. {
  133.     public String id = "";
  134.     public String href = "";
  135.     public String alt = "";
  136.     public String name = "";
  137.  
  138.     public MenuItem(String _id, String _hRef, String _alt, String _name)
  139.     {
  140.         id = _id.trim();
  141.         href = _hRef.trim();
  142.         alt = _alt.trim();
  143.         name = _name.trim();
  144.     }
  145. }
  146. %>
  147.